#include<iostream>
#include<stack>
#include<string>
#include<vector>
using namespace std;

class Solution {
public:
    int evalRPN(vector<string>& tokens) {
        stack<int> Input;
        int i = 0;
        while (i < tokens.size())
        {
            string token = tokens[i];
            if (isdigit(token[0]))
            {
                Input.push(stoi(token));
            }
            else
            {
                auto x = Input.top();
                Input.pop();
                auto y = Input.top();
                Input.pop();
                switch (token[0]) {
                case '+':
                    Input.push(x + y);
                    break;
                case '-':
                    Input.push(x - y);
                    break;
                case '*':
                    Input.push(x * y);
                    break;
                case '/':
                    Input.push(x / y);
                    break;
                default:
                    break;
                }
            }
            i++;
        }
        return Input.top();
    }
};

int main()
{
    //"4","13","5","/","+"
    Solution s;
    vector<string> vs;
    vs.push_back("4");
    vs.push_back("13");
    vs.push_back("5");
    vs.push_back("/");
    vs.push_back("+");

    int ret = s.evalRPN(vs);
    cout << ret << endl;

}